#pragma once

namespace Microsoft {
	namespace Media {
		namespace FragmentedMediaSink {

			public ref class Fragment sealed
			{
			private:
				unsigned int streamIndex;

				unsigned int fragmentIndex;

				unsigned long long startTime;

				unsigned long long endTime;

				Windows::Storage::Streams::IRandomAccessStream^ stream;

			internal:
				Fragment(Windows::Storage::Streams::IRandomAccessStream^ stream, unsigned int streamIndex, unsigned int fragmentIndex) :
					stream(stream),
					streamIndex(streamIndex),
					fragmentIndex(fragmentIndex)
				{ }

			public:
				property Windows::Storage::Streams::IRandomAccessStream^ Stream
				{
					Windows::Storage::Streams::IRandomAccessStream^ get()
					{
						return stream;
					}
				}

				property unsigned int StreamIndex
				{
					unsigned int get()
					{
						return streamIndex;
					}
				}

				property unsigned int FragmentIndex
				{
					unsigned int get()
					{
						return fragmentIndex;
					}
				}

				property unsigned long long StartTime
				{
					unsigned long long get()
					{
						return startTime;
					}
					void set(unsigned long long value)
					{
						startTime = value;
					}
				}

				property unsigned long long EndTime
				{
					unsigned long long get()
					{
						return endTime;
					}
					void set(unsigned long long value)
					{
						endTime = value;
					}
				}
			};

			public interface class IFragmentController
			{
			public:
				Windows::Storage::Streams::IRandomAccessStream^ StartFragment();

				void FragmentCompleted(Fragment^ fragment);

				property Windows::Foundation::TimeSpan FragmentSize
				{
					Windows::Foundation::TimeSpan FragmentSize::get();
				}

				property Windows::Media::MediaProperties::IMediaEncodingProperties^ EncodingProperties
				{
					Windows::Media::MediaProperties::IMediaEncodingProperties^ EncodingProperties::get();
				}
			};
		}
	}
}